package com.guqj.basis.aop.spring;

import org.springframework.aop.framework.ProxyFactory;

public class GreetingProxy {

	public static void main(String[] args) {
		ProxyFactory proxyFactory = new ProxyFactory();
		IGreeting iGreeting = new GreetingImpl();
		proxyFactory.setOptimize(false);
		proxyFactory.setProxyTargetClass(false);
		proxyFactory.setTarget(iGreeting);
		proxyFactory.addAdvice(new GreetingAfterAdvice());
		proxyFactory.addAdvice(new GreetingBeforeAdvice());
		iGreeting = (IGreeting) proxyFactory.getProxy();
		iGreeting.speak();
		iGreeting.get();
	}
}
